home *** CD-ROM | disk | FTP | other *** search
- /* ShowSystemVolumeName.c */
- /*
- * ShowSystemVolumeName.c
- * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved.
- */
- #include <Folders.h>
- #include <GestaltEqu.h>
- #include <Files.h>
- #include <Devices.h>
- #include <Memory.h>
- #include <Traps.h>
- #include <stdio.h>
- void ShowSystemVolumeName(void);
- void ShowSCSIDeviceIdent(
- short driverRefNum
- );
-
- static void
- ClearMemory(
- Ptr ptr,
- Size size
- )
- {
- while (size > 0) {
- *ptr++ = 0;
- --size;
- }
- }
-
-
- void
- ShowSystemVolumeName(void)
- {
- OSErr status;
- long gestaltResult;
- short systemVRefNum;
- long systemFolderDirID;
- HVolumeParam pb;
- Str255 systemVolumeName;
-
- status = Gestalt(gestaltFindFolderAttr, &gestaltResult);
- if (status == noErr) { /* We have FindFolder */
- status = FindFolder(
- kOnSystemDisk,
- kSystemFolderType,
- kDontCreateFolder,
- &systemVRefNum,
- &systemFolderDirID
- );
- }
- if (status == noErr) {
- ClearMemory((Ptr) &pb, sizeof pb);
- pb.ioVolIndex = 0;
- pb.ioNamePtr = systemVolumeName;
- pb.ioVRefNum = systemVRefNum;
- status = PBHGetVInfoSync((HParmBlkPtr) &pb);
- }
- if (status == noErr) {
- printf("Boot volume \"%.*s\", drive %d, driver %d",
- systemVolumeName[0],
- &systemVolumeName[1],
- pb.ioVDrvInfo,
- pb.ioVDRefNum
- );
- ShowSCSIDeviceIdent(pb.ioVDRefNum);
- printf("\n");
- }
- }
-